/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.desitek.thunder.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author dt
 */
@Entity
@Table(name = "brand_category")
@NamedQueries({
    @NamedQuery(name = "BrandCategory.findAll", query = "SELECT b FROM BrandCategory b"),
    @NamedQuery(name = "BrandCategory.findById", query = "SELECT b FROM BrandCategory b WHERE b.id = :id")})
public class BrandCategory implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @JoinColumn(name = "category", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private Category category;
    @JoinColumn(name = "brand", referencedColumnName = "id")
    @ManyToOne
    private Brand brand;

    public BrandCategory() {
    }

    public BrandCategory(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public Brand getBrand() {
        return brand;
    }

    public void setBrand(Brand brand) {
        this.brand = brand;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BrandCategory)) {
            return false;
        }
        BrandCategory other = (BrandCategory) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

	@Override
	public String toString() {
		return "BrandCategory [id=" + id + ", category=" + category
				+ ", brand=" + brand + "]";
	}

    
    
}
